import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const Step1 = () =>
  import(/* webpackChunkName: "reservationForm/Step1" */ '../page/Step1.vue')
const Step2 = () =>
  import(/* webpackChunkName: "reservationForm/Step2" */ '../page/Step2.vue')

const router = new Router({
  routes: [
    {
      path: '/step1',
      component: Step1,
      name: 'step1'
    },
    {
      path: '/step2',
      component: Step2,
      name: 'step2'
    }
  ]
})
router.beforeEach((to, from, next) => {
  console.log('~~~from.path', from.path)
  console.log('~~~to.path', to.path)
  let path = '/'
  // console.log('~~~to.path', to.path)
  if (path === to.path) {
    router.replace({ path: 'step1' })
  }
  next()
})
export default router
